package com.start_eternity.oasissafewalk.exception;

import com.start_eternity.oasissafewalk.comment.ErrorCode;

/**
 * author:ZhangT
 * Date:2024 / 04 / 15 / 11:19
 * Description:
 */
public class BusinessException extends RuntimeException {

    private final int code;

    private final String description;

    public BusinessException(int code, String message,String description) {
        super(message);
        this.code = code;
        this.description = description;
    }

    public BusinessException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description = null;
    }
    public BusinessException(ErrorCode errorCode, String description) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description = description;
    }
    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
